package com.wangju.chapter8.controller;

import com.wangju.chapter8.pojo.User;
import com.wangju.chapter8.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

@Controller
@RequestMapping("/user")
public class UserController {


    @Autowired
    UserService userService;

    @RequestMapping("/details")
    @ResponseBody
    public User detail(Long id) {

        System.out.println(id);
        User user = userService.findUser(id);
        System.out.println(user);
        return user;
    }


}
